package cn.biplam.front.component.data.tree.test;

import cn.biplam.common.ajxcode.SystemCode.TreeDcIndexCode;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.data.tree.treebase.TreeCallBackImg;
import cn.biplam.front.component.data.tree.treebase.TreeCallBackNew;
import cn.biplam.front.component.data.tree.treebase.TreeDcCustom;
import cn.biplam.front.component.data.tree.treebase.TreeDcIndex;
import cn.biplam.front.component.data.tree.treebase.Tree_Type.Tree_NodeType_Commen;
import cn.biplam.front.component.data.tree.treebase.Tree_Type.Tree_PicType;
import cn.biplam.front.component.data.tree.treebase.img.PlusMinus;
import cn.biplam.front.component.view.tree.TreeBase;
import cn.biplam.front.component.view.tree.TreeView;

/**
 * 树vc测试类
 * @author WangSong 2009-10-13下午04:48:39
 * @version 1.0
 */
public class SelectTree extends TreeView {
	
	public static final String cId="920";
	public static final String aId=cId+"01";
	private String testId;
	
	public SelectTree(){
		super(aId);
	}
	
	public SelectTree(String testId) {
		super(aId);
		this.testId = testId;
	}

	@Override
	protected void setTree(TreeBase treeBase,UserInfo mUser) throws ErrorMessage {
		/**树的callback设置*/
		TreeCallBackNew callback = new TreeCallBackNew();
		TreeCallBackNew callback2 = new TreeCallBackNew();
		/**设置左键*/
		callback.putLeftClick(Tree_NodeType_Commen.Leaf, "880201", "domain");
		/**设置左键*/
		callback.putLeftClick(Tree_NodeType_Commen.SubTheme, "880201", "domain");
		/**设置左键*/
		callback.putLeftClick(Tree_NodeType_Commen.RootTheme, "880201", "domain");
		
		/**设置左键*/
		callback2.putLeftClick(Tree_NodeType_Commen.Leaf, "880201", "domain");
		/**设置左键*/
		callback2.putLeftClick(Tree_NodeType_Commen.SubTheme, "880201", "domain");
		/**设置左键*/
		callback2.putLeftClick(Tree_NodeType_Commen.RootTheme, "880201", "domain");

		/**设置树dc*/
		treeBase.putTreeDc(1,new TreeDcIndex(mUser,"select_index","tttt","2"), callback);
		treeBase.putTreeDc(2,new TreeDcCustom(mUser,"bbbb","30001301","1111","2"), callback);
		//treeBase.putTreeDc(2,new TreeDcIndex(mUser,"select_sub_index","ssss","1"), callback2);
//		TreeDcParent dcp = new TreeDcParent(mUser,"SELECT_WHERE_PARAM",null);
//		dcp.setMappingNodeId("param_id");
//		dcp.setMappingNodeName("param_name");
//		dcp.setMappingNodeParent("parent_id");
//		dcp.setMappingRealId("param_id");
		//treeBase.putTreeDc(2,dcp,callback);
		treeBase.setShowVirRoot(false,true);
		/**设置右键*/
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.RootTheme, TreeDcIndexCode.Add_Theme, TreeDcIndexCode.Caption_Add_Theme);
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.RootTheme, TreeDcIndexCode.Edit, TreeDcIndexCode.Caption_Modify);
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Add_Theme, TreeDcIndexCode.Caption_Add_Theme);
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Add_Leaf, TreeDcIndexCode.Caption_Add,"2");
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Edit, TreeDcIndexCode.Caption_Modify);
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Del, TreeDcIndexCode.Caption_Delete);
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.Leaf, TreeDcIndexCode.Add_Leaf, TreeDcIndexCode.Caption_Add);
		treeBase.putRightMenuItem(1,Tree_NodeType_Commen.Leaf, TreeDcIndexCode.Del, TreeDcIndexCode.Caption_Delete);
		
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.RootTheme, TreeDcIndexCode.Add_Theme, TreeDcIndexCode.Caption_Add_Theme);
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Add_Theme, TreeDcIndexCode.Caption_Add_Theme);
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Add_Leaf, TreeDcIndexCode.Caption_Add);
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Edit, TreeDcIndexCode.Caption_Modify);
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.SubTheme, TreeDcIndexCode.Del, TreeDcIndexCode.Caption_Delete);
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.Leaf, TreeDcIndexCode.Add_Leaf, TreeDcIndexCode.Caption_Add);
		treeBase.putRightMenuItem(2,Tree_NodeType_Commen.Leaf, TreeDcIndexCode.Del, TreeDcIndexCode.Caption_Delete);

		/**设置右键显示*/
		treeBase.setRightMenu(true);
		treeBase.setExtraOperatorIdAdd(1, "30001301");
		treeBase.setCustomerParam("ppp","11111");
		treeBase.putSubTreeParam(1,"test1",testId);
		treeBase.putSubTreeParam(2,"test1",testId);
		treeBase.setShowCheckBox(true);
		setTreeImg(treeBase);
	}

	protected void setTreeImg(TreeBase treeBase) throws ErrorMessage {
		treeBase.setPic(1, Tree_PicType.Blue);
		TreeCallBackImg tb = TreeCallBackImg.getInstanct(Tree_PicType.Windows);
//		tb.setCustomer("re_f.gif", "4");
//		tb.setCustomer("fd.gif","4", "3");
//		tb.setPicSubThemeHaveChild("df.gif","2");
//		tb.setPicSubThemeHaveChild("duf.gif");
		tb.setPlusMinus(new PlusMinus(true));
		treeBase.setPic(2,tb);
	}
}
